home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bc_ti.zip / TI719.ASC < prev    next >
Text File  |  1992-02-25  |  941b  |  67 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland C++                            NUMBER  :  719
  9.   VERSION  :  2.0
  10.        OS  :  DOS
  11.      DATE  :  February 25, 1992                        PAGE  :  1/1
  12.  
  13.     TITLE  :  Getting the Size of a File
  14.  
  15.  
  16.  
  17.  
  18.   /***************************************************
  19.  
  20.   This program shows how to get the size of a file.
  21.  
  22.   ***************************************************/
  23.  
  24.   #include <string.h>
  25.   #include <stdio.h>
  26.   #include <fcntl.h>
  27.   #include <io.h>
  28.  
  29.   int main(void)
  30.   {
  31.      int handle;
  32.      char buf[11] = "0123456789";
  33.  
  34.      /* create a file containing 10 bytes */
  35.      handle = open("DUMMY.FIL", O_CREAT);
  36.      write(handle, buf, strlen(buf));
  37.  
  38.      /* display the size of the file */
  39.      printf("file length in bytes: %ld\n",
  40.             filelength(handle));
  41.  
  42.      /* close the file */
  43.      close(handle);
  44.      return 0;
  45.   }
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.